// Handle client-side vehicle store purchasing

private ["_vecString","_vecPoints","_playerPoints"];
_vecString = (_this select 0);
_playerPoints = pointsLogic getVariable [(getPlayerUID player), 0];
switch (_vecString) do {
	case "pawnee" : { _vecPoints = 50 };
	case "blackfoot" : { _vecPoints = 100 };
	case "buzzard" : { _vecPoints = 150 };
	case "wipeout" : { _vecPoints = 250 };
};

// Exit if all spawn locations are full
if ((count (nearestObjects [vehiclestore2,["AllVehicles"], 10]) > 0) AND (count (nearestObjects [vehiclestore1,["AllVehicles"], 10]) > 0)) exitWith {
	systemChat "All vehicle spawns are currently occupied, please try again later";
};

// Exit and give a message if the player lacks enough points
if (_playerPoints >= _vecPoints) then {
	_nil = [[player, _vecString], "SXP_fnc_vehicleStore", false] call BIS_fnc_MP;
	systemChat "Thank you for using the AWG vehicle store";
} else {
	systemChat format ["You need %1 more points to purchase this vehicle", _vecPoints - _playerPoints];
};

